﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;

namespace WebApiGateway.Controllers
{
    public class PaymentController : Controller
    {
        private readonly string gatewayUrl;
        private PaymentController(IConfiguration configuration)
        {
            gatewayUrl = configuration["Gateway:Uri"];

        }


        public async Task<IList<string>> Get(string account)
        {
            using var client = WebApiClient.Create<IPaymentWebApi>(gatewayUrl);
            var historyList = await client.GetPaymentHistoryByAccountAsync(account);

            return historyList;

        }
             
    }
}
